* This do file replicates Nunn (2010) adding our controls to his specifications

* Set file directory path using <cd>

use "Appendix Table A12\replicating_nunn_africa.dta", replace

********************************************************************************
********************************
*** Nunn Table 1, column 1
*** Mission station among ethnic group 
********************************

** Nunn variables
local control_individual "age age2 male urban_dum"
local control_ethnicity  "eth_ln_export_area eth_explorer_contact eth_railway_contact_dissect97 eth_soil5 eth_river_nav10km eth_altitude"
local eth_ours "eth_yrstudy_yn eth_yrstudy1924 eth_prec_mean eth_altitude eth_alt_std eth_soil5 eth_malaria eth_tsetse eth_nslaveports eth_lndist2coast eth_ncity1400 eth_ncity1800 eth_missing_murdock eth_centra eth_date_col_min eth_nevercolonised eth_ldist2muslimcentre eth_ldensity1800m eth_ldist2river eth_nlakecells eth_ldist2lake eth_explorer_contact eth_rail1924 eth_rail1924_25 eth_density1800m eth_nationalcities eth_lcitypop1900 eth_lurbc1900 eth_lrurc1900 eth_slavery eth_ln_export_area eth_lcellvalue1924all eth_mines1924 eth_polygamy"

sum education lntotal_missions_nunn `control_individual' `control_ethnicity' `eth_ours'

* Notes: Nunn used the fraction of land within ten kilometers of a water source. Moroever, Nunn used the proportion of arable land. The souces became unavailable.
// Missing: the proportion of land that is within 10 kilometers of a fresh water source. Instead we use  “major navigable river” and a lake as mapped by \citep0{0000000000Johnston1900000000000015}.
// Instead of "the proportion of the ethnic group's land that is suitable for agriculture" we use 5 indicator variables for the soil suitable for cultivation map 5.6
// Combined suitability of currently available land for pasture and rainfed crops (low input level) (FGGD) 
// http://www.fao.org:80/geonetwork/srv/en/resources.get?id=14176&fname=Map6_65.zip&access=private

* 1. Replication, Table 1, column 1 using Nunn's specification and control variables
reg education lntotal_missions_nunn `control_individual' `control_ethnicity' i.isocodefe , vce(cluster murdock_name)
outreg2 lntotal_missions_nunn loc_missionnunn using "Appendix Table A12\Appendix Table A12_Africa.xls", keep(lntotal_missions_nunn) addtext(Individual-level controls, Yes, Ethnicity-level controls, Yes, Village-level controls, No, Controls, std, Country Fixed Effects, Yes) br se nocons coefastr bdec(2) sdec(2) rdec(2) noni nolabel replace

* 2. Replication, Table 1, column 1 using Nunn's specification and OUR variables
reg education lntotal_missions_nunn `control_individual' `eth_ours' i.isocodefe, vce(cluster murdock_name)
outreg2 lntotal_missions_nunn loc_missionnunn using "Appendix Table A12\Appendix Table A12_Africa.xls", keep(lntotal_missions_nunn) addtext(Individual-level controls, Yes, Ethnicity-level controls, Yes, Village-level controls, No, Controls, ours, Country Fixed Effects, Yes) br se nocons coefastr bdec(2) sdec(2) rdec(2) noni nolabel append

* 3. Replication, Table 1, column 1 using Nunn's specification, OUR variables and Beach Type
reg education lntotal_missions_nunn eth_lbeach03_pro_yn_0 eth_lbeach03_pro_yn_50 eth_lbeach03_pro_yn_100 `control_individual' `eth_ours' i.isocodefe, vce(cluster murdock_name)
outreg2 lntotal_missions_nunn loc_missionnunn using "Appendix Table A12\Appendix Table A12_Africa.xls", keep(lntotal_missions_nunn) addtext(Individual-level controls, Yes, Ethnicity-level controls, Yes, Village-level controls, No, Controls, ours + type, Country Fixed Effects, Yes) br se nocons coefastr bdec(2) sdec(2) rdec(2) noni nolabel append
********************************************************************************



********************************************************************************
********************************
*** Nunn Table 1, column 2
*** Mission station in village M
********************************

* Nunn controls
local control_individual "age age2 male urban_dum"
local control_village "loc_explorer_contact dist2river_nav10km dist2lake10km loc_railway_contact_dissect97 ln_export_area soil5 alt_mean" // Village level variables -> Is ln_export_area village level?

* Our controls
local ours24murd2 "yrstudy_yn yrstudy1924 prec_mean alt_mean alt_std soil5 malaria tsetse dist2slaveport_10km lndist2coast city1400 city1800 missing_murdock centra nevercolonised date_col ldist2muslimcentre dist2river_nav10km dist2lake10 dist2explorer10 dist2rail192410 density1800m dist2nationalcity10 lcitypop1900_10 lurbc1900 lrurc1900 slavery ln_export_area lcellvalue1924all mines1924_50km polygamy"
local ours24murd2_25 "dist2nationalcity_25 ldist2nationalcity dist2muslimcentre_25 dist2river_25 dist2lake_25 dist2_dist2explorer_25 dist2rail1924_25 ldist2rail1924 loc_ncity1400_25 loc_ncity1800_25 loc_ncity1400_25dum loc_ncity1800_25dum  locn_slaveports_25km loc_density1800m_25 loc_lcitypop1900_25 loc_lurbc1900_25 loc_lrurc1900_25"

sum education loc_missionnunn `control_individual' `control_village' `ours24murd2' `ours24murd2_25'

* Notes:
// Replicating Nunn's controls 
// loc_explorer_contact:  An indicator variable equal to one if the inhabitant's current village was contacted by a European explorer prior to colonial rule (1885)
* An indicator variable equal to one if a railway line dissected the village (1897)
// loc_railway_contact_dissect97: railway dissects the grid in which the village is located 
* The log number of slaves exported per land area during the Atlantic and Indian Ocean slave trades among the ethnic group that historically inhabited the village
// loc_ln_export_area 
* the fraction of the land within the village (25 kilometer radius of the centroid) that is suitable for cultivation
// loc_soil5: soil index (1-5) Mean of cells within 25 km radius of the village 
* the fraction of the village land that is within 10 kilometers of a fresh water source
// dist2river_nav10km: Grid within 10 km of navigable river
* The average elevation of the village: 
// loc_altitude: the average elevation of the grids within 25 km distance of village


* 4.  Replication, Table 1, column 2 using Nunn's specification and control variables
areg education loc_missionnunn `control_individual' `control_village', absorb(isocodefe) vce(cluster murdock_name)
outreg2 loc_missionnunn using "Appendix Table A12\Appendix Table A12_Africa.xls", keep(loc_missionnunn ) addtext(Individual-level controls, Yes, Ethnicity-level controls, No, Village-level controls, Yes, Controls, std, Country Fixed Effects, Yes) br se nocons coefastr bdec(2) sdec(2) rdec(2) noni nolabel append
* 5. Replication, Table 1, column 2 using Nunn's specification and OUR variables, 25 km radius
areg education loc_missionnunn `control_individual' `ours24murd2' `ours24murd2_25', absorb(isocodefe) vce(cluster murdock_name)
outreg2 loc_missionnunn using "Appendix Table A12\Appendix Table A12_Africa.xls", keep(loc_missionnunn) addtext(Individual-level controls, Yes, Ethnicity-level controls, No, Village-level controls, Yes, Controls, ours25, Country Fixed Effects, Yes) br se nocons coefastr bdec(2) sdec(2) rdec(2) noni nolabel append
* . Controlling for Beach Type
areg education loc_missionnunn loc_beach03_pro_yn_0 loc_beach03_pro_yn_50 loc_beach03_pro_yn_100  `control_individual' `ours24murd2' `ours24murd2_25', absorb(isocodefe) vce(cluster murdock_name)
outreg2 loc_missionnunn using "Appendix Table A12\Appendix Table A12_Africa.xls", keep(loc_missionnunn) addtext(Individual-level controls, Yes, Ethnicity-level controls, No, Village-level controls, Yes, Controls, ours25 + type, Country Fixed Effects, Yes) br se nocons coefastr bdec(2) sdec(2) rdec(2) noni nolabel append
********************************************************************************



********************************************************************************
********************************
*** Nunn, Table 1, column 2 for Ghana ***
*** Mission station in village M
********************************

use "Appendix Table A12\replicating_nunn_ghana.dta", replace

local control_individual "age age2 male urban_dum"
local control_village "loc_explorer_contact loc_cells_river ln_export_area soil5 alt_mean" // Village level variables -> Is ln_export_area village level?

local ssactrls1924 "soil5 prec_mean ldist2coast histo_malaria tsi city1800 yrstudy_yn yrstudy1924 missing_murdock date_col centra ldist2muslimcentre port1850_yn dist2riv_navigable10 ldist2explorer dist2rail30 density1800m city10k_1900 lurbc1900 lrurc1900 slavery ln_export_area lgridvalue1924 minet_dist50 polygamy"
local ourctrls "prec_mean alt_mean alt_sd soil5 histo_malaria port1850_yn ldist2coast nongcc1873 dist2riv_navigable10 traderoute18501890_dist10 exploroute188089_dist10 dist2rail193210 dist2class123_193010 city1800 map08_yn national headchief lupop_1891 lupop_1901 lrpop_1901 lupop_1931 lrpop_1931 ln_export_area slavemarket_strict_dist50 palmoil1900_dist50 kolanut0 rubber1900_dist50 cocoa minet_dist1932_50"
local type "period1 period2 mainstat_yn asstschools_yn eurononmain4690 euromain4690"

sum `control_individual' `control_village' `stdctrls' `ssactrls1924'  `type'


* 1. Number of Atlas missions in 25 km distance
* a) Nunn controls
acreg education loc_roomemissions `control_individual' `control_village' area_sqkm, latitude(latitude) longitude(longitude) dist(100) spatial 
outreg2 missions_yn roome24_mis_yn loc_roomemissions using "Appendix Table A12\Appendix Table A12_Ghana.xls", keep(missions_yn loc_roomemissions) addtext(Individual-level controls, Yes, Missions, Roome 25 km, Village-level controls, std) br se nocons coefastr bdec(2) sdec(2) rdec(2) noni nolabel excel replace
* b) Africa controls
acreg education loc_roomemissions `control_individual' `ssactrls1924' area_sqkm, latitude(latitude) longitude(longitude) dist(100) spatial
outreg2 missions_yn roome24_mis_yn loc_roomemissions using "Appendix Table A12\Appendix Table A12_Ghana.xls", keep(missions_yn loc_roomemissions) addtext(Individual-level controls, Yes, Missions, Roome 25 km, Village-level controls, ssa) br se nocons coefastr bdec(2) sdec(2) rdec(2) noni nolabel append
* c) Our controls
acreg education loc_roomemissions `control_individual' `ourctrls' area_sqkm, latitude(latitude) longitude(longitude) dist(100) spatial
outreg2 missions_yn roome24_mis_yn loc_roomemissions using "Appendix Table A12\Appendix Table A12_Ghana.xls", keep(missions_yn loc_roomemissions) addtext(Individual-level controls, Yes, Missions, Roome 25 km, Village-level controls, ours) br se nocons coefastr bdec(2) sdec(2) rdec(2) noni nolabel append
* d) Our cntrls + type
acreg education loc_roomemissions `control_individual' `ourctrls' `type' area_sqkm, latitude(latitude) longitude(longitude) dist(100) spatial
outreg2 missions_yn roome24_mis_yn using "Appendix Table A12\Appendix Table A12_Ghana.xls", keep(missions_yn loc_roomemissions) addtext(Individual-level controls, Yes, Missions, Roome 25 km, Village-level controls, ours + type) br se nocons coefastr bdec(2) sdec(2) rdec(2) noni nolabel append


* 2. Our framework (BB mission dummy by grid)
* a) Nunn controls
acreg education missions_yn `control_individual' `control_village' area_sqkm , latitude(latitude) longitude(longitude) dist(100) spatial 
outreg2 missions_yn roome24_mis_yn loc_ourmissions using "Appendix Table A12\Appendix Table A12_Ghana.xls", keep(missions_yn loc_roomemissions) addtext(Individual-level controls, Yes, Missions, BB Mission dummy, Village-level controls, std) br se nocons coefastr bdec(2) sdec(2) rdec(2) noni nolabel append
* b) Africa controls
acreg education missions_yn `control_individual' `ssactrls1924' area_sqkm , latitude(latitude) longitude(longitude) dist(100) spatial 
outreg2 missions_yn roome24_mis_yn loc_ourmissions using "Appendix Table A12\Appendix Table A12_Ghana.xls", keep(missions_yn loc_roomemissions) addtext(Individual-level controls, Yes, Missions, BB Mission dummy, Village-level controls, ssa) br se nocons coefastr bdec(2) sdec(2) rdec(2) noni nolabel append
* c) Our controls
acreg education missions_yn `control_individual' `ourctrls' area_sqkm , latitude(latitude) longitude(longitude) dist(100) spatial
outreg2 missions_yn roome24_mis_yn loc_roomemissions using "Appendix Table A12\Appendix Table A12_Ghana.xls", keep(missions_yn loc_roomemissions) addtext(Individual-level controls, Yes, Missions, BB Mission dummy, Village-level controls, ours) br se nocons coefastr bdec(2) sdec(2) rdec(2) noni nolabel append
* d) Our cntrls + type
local type "period1_25dummy period2_25dummy mainstat_yn_25dummy asstschools_yn_25dummy eurononmain4690_25dummy euromain4690_25dummy"
acreg education missions_yn `control_individual' `ourctrls' `type' area_sqkm , latitude(latitude) longitude(longitude) dist(100) spatial
outreg2 missions_yn roome24_mis_yn loc_roomemissions using "Appendix Table A12\Appendix Table A12_Ghana.xls", keep(missions_yn loc_roomemissions) addtext(Individual-level controls, Yes, Missions, BB Mission dummy, Village-level controls, ours + type) br se nocons coefastr bdec(2) sdec(2) rdec(2) noni nolabel append